package com.itheima.api.stream.demo05;

import java.util.ArrayList;
import java.util.stream.Stream;

public class StreamDemo01 {

    public static void main(String[] args) {

        ArrayList<String> manActorArrayList = new ArrayList<String>();
        ArrayList<String> womanActorArrayList = new ArrayList<String>();

        manActorArrayList.add("张国立");
        manActorArrayList.add("黄日华");
        manActorArrayList.add("刘烨");
        manActorArrayList.add("郑伊健");
        manActorArrayList.add("徐峥");
        manActorArrayList.add("王宝强");

        womanActorArrayList.add("刘亦菲");
        womanActorArrayList.add("林青霞");
        womanActorArrayList.add("林岚") ;
        womanActorArrayList.add("林允儿");
        womanActorArrayList.add("贾玲") ;
        womanActorArrayList.add("张曼玉") ;

        Stream<String> stream1 = manActorArrayList.stream().filter(s -> s.length() == 3).limit(3);

        Stream<String> stream2 = womanActorArrayList.stream().filter(s -> s.startsWith("林")).skip(1);

        Stream<String> stream = Stream.concat(stream1, stream2);

        stream.forEach(s -> {
            Actor actor = new Actor(s);
            System.out.println(actor);
        });

    }

}
